import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    WebView,
} from 'react-native';
//https://www.i-fbs.com/api.php?app=theme&act=getArticleInfo&id= &type=ios
//article_id
var  NewsDetail = React.createClass({
    getDefaultProps(){
        return{
            url_api:'https://www.i-fbs.com/api.php?app=theme&act=getArticleInfo&id= &type=ios',
        }
    },
    getInitialState(){
        return{
            detailData :[],
        }
    },
    render() {
        return (
            <WebView
                automaticallyAdjustContentInsets={true}
                style={styles.webView}
                source={{html:'baidu', baseUrl:''}}
                javaScriptEnabled={true}
                domStorageEnabled={true}
                startInLoadingState={true}
                scalesPageToFit={this.state.scalesPageToFit}
            />
        );
    },
    componentDidMount(){
        //请求路径
      var  url_api = 'https://www.i-fbs.com/api.php?app=theme&act=getArticleInfo&id=' + this.props.rowData.article_id + '&type=ios';
      console.log(this.props.rowData.article_id
      );
      //发送请求
        fetch(url_api)
            .then((response) => response.json())
            .then((responseData) => {
            //处理拿到的数据
                var allData =  responseData[this.props.rowData]

            })
            .catch((error) =>{
            //请求数据失败
                alert(请求数据失败)
            })


    },
});

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});

module.exports = NewsDetail;